package edu.uwm.univesitydb.mock;


import edu.uwm.universitydb.swing.DataTableModel;

public class MockPerformanceService extends DataTableModel{

	public MockPerformanceService() {
		super(_colNames, _colTypes);
	}

	public boolean runTests() {
		try {

			_time = new double[] {
					0.502,
					0.985,
					1.222,
					0.988,
					2.00
					
			};
			_test = new String[] {
					"Query 1 with index A",
					"Query 1 without index",
					"Query 2 with index A",
					"Query 2 with index A,B",
					"Query 2 without index"
			};
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		return true;
	}
	

	@Override
	public int getRowCount() {
		return _test.length;
	}
	
	@Override
	public Object getValueAt(int row, int col) {
		switch (col) {
		case 0:
			return _test[row];
		case 1:
			return _time[row];
		default:
			return "Error";
		}
	}
	
	private double[] _time = new double[] {};
	private String[] _test = new String[] {};
	
	private static final String[] _colNames = new String[] {"Test Name","Result"};
	private static final Class<?>[] _colTypes = new Class<?>[] {String.class, String.class};
	
	private static final long serialVersionUID = -8689299622517228820L;

	

}
